<?php 
	$sysApps = new sysApps();
?>

<div class="account-info">
	<div class="pageTitle">Account Info</div>
    
    <div class="frm_rows">
        <div class="frm_left">New Password</div>
        <div class="frm_right"><INPUT name="new_pass" type="password" class="inputTextbox" id="new_pass" ></div>
    </div>
        <div class="frm_rows">
        <div class="frm_left">Old Password</div>
        <div class="frm_right"><INPUT name="old_pass" type="password" class="inputTextbox" id="old_pass" ></div>
    </div>
    <div class="frm_rows">
        <div class="frm_left"></div>
        <div class="frm_right"><div class="smallButton">Submit</div></div>
    </div>
    
    <div class="frm_rows">
        <div class="frm_left"></div>
        <div class="frm_right"><div class="notify"><div class="notify-msg">test</div></div></div>
    </div>
</div>

<script>

$(document).ready(function(){
	$('.notify').hide();
	
	$('.smallButton').click(function(){
		var id = '<?php echo $_SESSION['user_MGM_id'];?>';
		var new_pass = $('#new_pass').val();
		var old_pass = $('#old_pass').val();
		
		$.post("<?php echo $sysApps->BASEurl();?>members/func/change-pass.php",{id:id, new_pass:new_pass, old_pass:old_pass},function(response){
			switch(response)
			{
			case '1':
			  $('.notify').show("slide",{direction: 'down'});
					$('.notify').delay(2000).hide("slide",{direction: 'up'});
					$('.notify-msg').removeClass("check_error").addClass("check_pass").text("Profile Has Been Saved");
					$('#new_pass').val("");
					$('#old_pass').val("");
					return false;	
			  break;
			  
			 case '2':
			  $('.notify').show("slide",{direction: 'down'});
					$('.notify').delay(2000).hide("slide",{direction: 'up'});
					$('.notify-msg').removeClass("check_pass").addClass("check_error").text("Old Password Incorrect!!");
					return false;	
			  break;
			
			default:
			$('.notify').show("slide",{direction: 'down'});
					$('.notify').delay(2000).hide("slide",{direction: 'up'});
					$('.notify-msg').removeClass("check_pass").addClass("check_error").text("Something went wrong, Please contact Admnistrator");
					return false;
					
			  
			}
		});
	});
	
	
	
});

</script>